//数状数组
//https://www.luogu.com.cn/problem/P3374
#include <iostream>
#include <vector>
#include <queue>
using namespace std;

typedef long long LL;

#define lc (p << 1)		//左孩子 parent * 2 
#define rc (p << 1 | 1) //右孩子 parent * 2 + 1
const int N = 5e5 + 10;
int n, m;

//原数组
int arr[N];

//线段树设计
struct node
{
	int l; int r;
	LL sum;
}tree[N * 4];

void getsum(int p)
{
	tree[p].sum = tree[lc].sum + tree[rc].sum;
}

//构建线段树
void build(int p, int l, int r)
{
	//初始化
	tree[p] = { l,r,arr[l] };
	if (l == r) return;

	//构建子树
	build(lc, l, (l + r) / 2); build(rc, (l + r) / 2 + 1, r);
	//计算和
	getsum(p);
}

//查找区间和
LL findsum(int p, int l, int r)
{
	int tl = tree[p].l; int tr = tree[p].r; int tsum = tree[p].sum;
	if (l <= tl && r >= tr) return tsum;
	int mid = tl + (tr - tl) / 2;
	
	LL tmp = 0;
	if (l <= mid) tmp += findsum(lc, l, r);
	if (r > mid) tmp += findsum(rc, l, r);
	return tmp;
}

//对某个数修改
void modify(int p, int x, LL y)
{
	int tl = tree[p].l; int tr = tree[p].r; int tsum = tree[p].sum;
	if (tl == x && tr == x)
	{
		tree[p].sum += y;
		return;
	}

	int mid = tl + (tr - tl) / 2;
	if(x <= mid) modify(lc, x, y);
	else modify(rc, x, y);
	getsum(p);
}


int main()
{
	cin >> n >> m;
	for (int i = 1; i <= n; i++) cin >> arr[i];
	build(1, 1, n);

	for (int i = 1; i <= m; i++)
	{
		int op, x, y; cin >> op >> x >> y;
		if (op == 1)
		{
			modify(1, x, y);
		}
		else
		{
			cout << findsum(1, x, y) << endl;
		}
	}
	return 0;
}